package com.qf.service;

import com.qf.mapper.UserMapper;
import com.qf.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * projectName: wokepase1
 *
 * @author: 强力
 * time: 2021/9/2 20:52
 * description:
 */
@Service
public class UserServiceImpl implements  UserService{



    @Autowired
    private UserMapper userMapper;

    @Override
    public List<User> findAll() {

       List<User> userList= userMapper.findUserAll();
        return userList;
    }

    @Override
    public int insertUser(User user) {
        user.setBirthday(new Date());
        user.setRegistTime(new Date());
        int i = userMapper.insertUser(user);
        return i;
    }

    @Override
    public int updateUser(User user) {
        user.setBirthday(new Date());
        user.setRegistTime(new Date());
        int i = userMapper.UpdatetUser(user);
        return i;
    }

    @Override
    public int delectUser(int id) {

        int i = userMapper.delectUser(id);

        return i;
    }
}
